import { createApp } from 'vue';
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import App from './App.vue';
import router from './router';
import pinia from './store';

// 创建Vue应用实例
const app = createApp(App);

// 使用插件
app.use(ElementPlus);
app.use(router);
app.use(pinia);

// 添加事件监听，处理浏览器前进/后退按钮
window.addEventListener('popstate', () => {
  // 强制刷新页面或重新加载当前路由
  const currentPath = window.location.pathname;
  if (currentPath === '/login' || currentPath === '/register') {
    // 如果是用户身份验证页面，强制刷新
    window.location.reload();
  }
});

// 挂载应用
app.mount('#app');
